﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Fitment
{
    public partial class dateInput : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["Date"] = this.lblDate.Text = this.calendarS.TodaysDate.AddDays(1).ToShortDateString();
            }
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            if (this.calendarS.Visible)
                this.calendarS.Visible = false;
            else
                this.calendarS.Visible = true;

            if (this.lblDate.Text != "")
            {
                this.calendarS.SelectedDate = DateTime.Parse(this.lblDate.Text);
            }
        }

        protected void calendarS_SelectionChanged(object sender, EventArgs e)
        {
            Session["Date"] = this.lblDate.Text = this.calendarS.SelectedDate.ToShortDateString();    //将选择的日期显示在文本框内
            this.calendarS.Visible = false;
        }
    }
}